package com.selene.sqlSession;

import java.beans.PropertyVetoException;
import java.io.InputStream;
import com.selene.config.XMLConfigureBuilder;
import com.selene.pojo.Configuration;
import org.dom4j.DocumentException;

public class SqlSessionFactoryBuilder {
    public SqlSessionFactory build(InputStream in) throws DocumentException, PropertyVetoException {
        XMLConfigureBuilder xmlConfigureBuilder = new XMLConfigureBuilder();
        Configuration configuration = xmlConfigureBuilder.parseConfig(in);

        //创建sqlSessionFactory
        DefaultSqlSessionFactory defaultSqlSessionFactory = new DefaultSqlSessionFactory(configuration);

        return defaultSqlSessionFactory;
    }
}
